﻿<%@ Page Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="categories.aspx.cs" Inherits="admin_categories" Title="Quản lý danh mục" %>

<%@ Register Assembly="RadAjax.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>
<%@ Register Assembly="RadGrid.Net2" Namespace="Telerik.WebControls" TagPrefix="rad" %>

<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" Runat="Server">
    <rad:RadAjaxPanel id="radAjaxPnAddCategory" runat="server" width="100%" HorizontalAlign="NotSet" LoadingPanelID="AjaxLoadingPanel1" ScrollBars="None">
    <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
        <tr>
            <td style="width: 50%">
    <rad:radgrid id="grdCats" runat="server"
        Width="100%"
        GridLines="None"
        Skin="Vista" OnNeedDataSource="grdCats_NeedDataSource" AutoGenerateColumns="False" ShowHeader="False" EnableAJAXLoadingTemplate="True" LoadingTemplateTransparency="25" OnDeleteCommand="grdCats_DeleteCommand" OnUpdateCommand="grdCats_UpdateCommand" EnableAJAX="True"
    >
        <ClientSettings AllowExpandCollapse="True">
            <Selecting AllowRowSelect="True" />
        </ClientSettings>
        <MasterTableView DataKeyNames="CatID,ParentID" EnableNoRecordsTemplate="False" HierarchyLoadMode="Client">
            <SelfHierarchySettings KeyName="CatID" MaximumDepth="20" ParentKeyName="ParentID" />
            <NoRecordsTemplate></NoRecordsTemplate>
            <Columns>
                <rad:GridBoundColumn DataField="CatName" UniqueName="CatName">
                </rad:GridBoundColumn>
                <rad:GridEditCommandColumn ButtonType="ImageButton">
                    <ItemStyle Width="20px" />
                </rad:GridEditCommandColumn>
                <rad:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ImageUrl="~/RadControls/Grid/Skins/Vista/Delete.gif"
                    UniqueName="column">
                    <ItemStyle Width="20px" />
                </rad:GridButtonColumn>
            </Columns>
            <ExpandCollapseColumn Resizable="False" Visible="False">
                <HeaderStyle Width="20px" />
            </ExpandCollapseColumn>
            <RowIndicatorColumn Visible="False">
                <HeaderStyle Width="20px" />
            </RowIndicatorColumn>
            <EditFormSettings EditFormType="Template">
                <EditColumn ButtonType="ImageButton" UniqueName="EditCommandColumn1">
                </EditColumn>
                <FormTemplate>
                    <table border="0" cellpadding="2" cellspacing="0" style="width: 250px">
                        <tr>
                            <td style="width: 80px; height: 17px">
                                Danh mục:</td>
                            <td style="width: 170px;">
                                <asp:TextBox ID="txtCatName" runat="server" Text='<%# Eval("CatName") %>' Width="125px" CssClass="Verdana8Black"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td style="width: 80px">
                            </td>
                            <td style="width:170px">
                                <asp:ImageButton ID="btnUpdate" runat="server" CommandName="Update" ImageUrl="~/RadControls/Grid/Skins/Vista/Update.gif"
                                    ToolTip="Lưu" />
                                <asp:ImageButton ID="btnCancel" runat="server" CommandName="Cancel" ImageUrl="~/RadControls/Grid/Skins/Vista/Cancel.gif"
                                    ToolTip="Huỷ" /></td>
                        </tr>
                    </table>
                </FormTemplate>
            </EditFormSettings>
        </MasterTableView>
    </rad:radgrid></td>
            <td style="width: 50%; padding-left:10px" align="left" valign="top">
                    <table border="0" cellpadding="5" cellspacing="5" style="border-right: #c6bda8 1px solid;
                        border-top: #c6bda8 1px solid; border-left: #c6bda8 1px solid; width: 100%; border-bottom: #c6bda8 1px solid">
                        <tr>
                            <td class="Verdana10Black" align="center"
                                style="background-color: #e3dfd4; border-right: #c6bda8 1px solid; border-top: #c6bda8 1px solid; border-left: #c6bda8 1px solid; border-bottom: #c6bda8 1px solid;">
                                <strong>Thêm danh mục</strong>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table border="0" cellpadding="5" cellspacing="0" style="width: 100%">
                                    <tr>
                                        <td colspan="2">
                                            <asp:Label ID="lblErr" runat="server" CssClass="Verdana8Red" Visible="False"></asp:Label></td>
                                    </tr>
                                    <tr>
                                        <td style="width: 95px">
                                            Tên danh mục:</td>
                                        <td>
                <asp:TextBox ID="txtNewCatName" runat="server" CssClass="Verdana8Black"></asp:TextBox></td>
                                    </tr>
                                    <tr>
                                        <td style="width: 95px">
                                        </td>
                                        <td>
                <asp:Button ID="btnAddCat" runat="server" CssClass="button" OnClick="btnAddCat_Click" Text="Thêm"/></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
            </td>
        </tr>
    </table>
    </rad:RadAjaxPanel>
    <rad:AjaxLoadingPanel ID="AjaxLoadingPanel1" runat="server" Height="75px" Transparency="0"
        Width="150px" HorizontalAlign="Center">
        <table border="0" cellpadding="3" cellspacing="0" style="width: 100%">
            <tr>
                <td align="center">
        <asp:Image ID="Image1" runat="server" AlternateText="Loading..." ImageUrl="~/imgs/ajaxLoading.gif"/></td>
            </tr>
        </table>
        <br />
    </rad:AjaxLoadingPanel>
</asp:Content>

